package edu.osu.intelligentagents.assignment1;

import java.text.DecimalFormat;

import edu.osu.intelligentagents.common.MDP;
import edu.osu.intelligentagents.common.NonStationaryPolicy;
import edu.osu.intelligentagents.common.State;

public class Assignment1 {
	public static void main(String[] args) {
		MDP mdp = new MDP(args[0]);
		DecimalFormat formatter = new DecimalFormat();
		formatter.applyPattern(".#");
		int h = 10;
		NonStationaryPolicy policy = new NonStationaryPolicy();
		policy.setMDP(mdp);
		policy.valueIteration(h);

		for (int i = 0; i < mdp.states.size(); i++) {
			System.out.print(mdp.states.get(i) + "\t");
			for (int j = 0; j < h; j++) {
				System.out.print("(A="
						+ policy.getAction(new State(i, "State" + i), j) + ")");
//				System.out.print("(V="
//						+ formatter
//								.format(mdp.states.get(i).getValues().get(j))
//						+ ",A="
//						+ policy.getAction(new State(i, "State" + i), j) + ")");

				// System.out.print("&(V="
				// + formatter
				// .format(mdp.states.get(i).getValues().get(j))
				// + ",A="
				// + policy.getAction(new State(i, "State" + i), j) + ")");
				// System.out.print("&("
				// + formatter
				// .format(mdp.states.get(i).getValues().get(j))
				// + ")");
				// System.out.print("&("
				// + mdp.policy.getAction(new State(i, "State" + i), j)
				// + ")");
			}
			System.out.println();
			// System.out.println("\\\\\\hline");
		}
		// System.out.println("------------------------");
//		System.out.println(policy.getAction(new State(14, "State6"), 3));
	}
}
